package A1_贪心算法;

import java.util.Arrays;

public class LC_455分发饼干 {
    public static void main(String[] args){
        int[] g={1,2,3};
        int[] s={1,1};
        System.out.println(findContentChildren(g,s));
    }
    public static int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int result=0;
        int index=s.length-1;
        for(int i=g.length-1;i>=0;i--){
            while(index>=0 && s[index]>=g[i]){
                result++;
                index--;
                break;
            }
        }
        return result;
    }
}
